From 312d18978b12cbec98d87a3d3a85fe6b6da4eb58 Mon Sep 17 00:00:00 2001 From: "iap10@striker.cl.cam.ac.uk" Date: Tue, 3 Feb 2004 19:21:37 +0000 Subject: [PATCH] bitkeeper revision 1.702 (401ff4c1wsnjlon2jUHePX5hLh-cGA) Delete junk tools. --- .rootkeys | 20 --- tools/examples/add_vbd_to_dom.py | 51 ------- tools/examples/createlinuxdom.py | 183 -------------------------- tools/examples/destroydom.py | 18 --- tools/examples/list_vbds.py | 8 -- tools/examples/listdoms.py | 10 -- tools/examples/pincpu.py | 31 ----- tools/examples/readxenconsolering.py | 48 ------- tools/examples/remove_vbd_from_dom.py | 29 ---- tools/examples/startdom.py | 15 --- tools/examples/stopdom.py | 15 --- tools/examples/vd_create.py | 36 ----- tools/examples/vd_delete.py | 23 ---- tools/examples/vd_format.py | 34 ----- tools/examples/vd_freespace.py | 11 -- tools/examples/vd_list.py | 10 -- tools/examples/vd_read_from_file.py | 29 ---- tools/examples/vd_refresh.py | 33 ----- tools/examples/vd_to_file.py | 34 ----- tools/examples/vd_undelete.py | 32 ----- tools/misc/xen_refresh_dev.c | 49 ------- 21 files changed, 719 deletions(-) delete mode 100644 tools/examples/add_vbd_to_dom.py delete mode 100755 tools/examples/createlinuxdom.py delete mode 100755 tools/examples/destroydom.py delete mode 100644 tools/examples/list_vbds.py delete mode 100755 tools/examples/listdoms.py delete mode 100755 tools/examples/pincpu.py delete mode 100644 tools/examples/readxenconsolering.py delete mode 100644 tools/examples/remove_vbd_from_dom.py delete mode 100755 tools/examples/startdom.py delete mode 100755 tools/examples/stopdom.py delete mode 100644 tools/examples/vd_create.py delete mode 100644 tools/examples/vd_delete.py delete mode 100644 tools/examples/vd_format.py delete mode 100644 tools/examples/vd_freespace.py delete mode 100644 tools/examples/vd_list.py delete mode 100644 tools/examples/vd_read_from_file.py delete mode 100644 tools/examples/vd_refresh.py delete mode 100644 tools/examples/vd_to_file.py delete mode 100644 tools/examples/vd_undelete.py delete mode 100644 tools/misc/xen_refresh_dev.c diff --git a/.rootkeys b/.rootkeys index 6870410f6d..0eb0465850 100644 --- a/.rootkeys +++ b/.rootkeys @@ -42,27 +42,8 @@ 3e6377dbGcgnisKw16DPCaND7oGO3Q tools/balloon/balloon.c 401d7e160vaxMBAUSLSicuZ7AQjJ3w tools/examples/Makefile 401d7e16UgeqroJQTIhwkrDVkoWgZQ tools/examples/README -40083bb4_j61quzxosgZ19LUgLlgYw tools/examples/add_vbd_to_dom.py -3fbe2f12OPAkzIUtumU3wRAihnhocQ tools/examples/createlinuxdom.py 401d7e16GS8YesM1zateRbaOoI6YLQ tools/examples/defaults 401d7e16NoWaBGC1RXbBcqAOr5Uaag tools/examples/democd -3fbe2f12dZbmXLlgQdMgkmnSUj23AQ tools/examples/destroydom.py -40083bb4lxCIf5HRu6fwWUyHCYOHKA tools/examples/list_vbds.py -3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/listdoms.py -3fca7700PVj36cZObaFZlQicRiw1pQ tools/examples/pincpu.py -3fd8bc48ww3aOqPhYjCr8KGulG0NQQ tools/examples/readxenconsolering.py -40083bb4zWkCUTHJKd1ApEOoPAuihg tools/examples/remove_vbd_from_dom.py -3fccbe068ov0YCxnk-2m4law19QMmA tools/examples/startdom.py -3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/stopdom.py -40083bb4LeyQyL-0riaV3UYDfHkl5g tools/examples/vd_create.py -40083bb4TmKs8pcFkOcJj1bKn3zcmg tools/examples/vd_delete.py -40083bb4u9Od6ujgect6mrxWfkk1pQ tools/examples/vd_format.py -400c33000SvWkdG92u4Bvdu6BPjGPw tools/examples/vd_freespace.py -400c3300jb_Ufz2kWsovGKNoDPEf-A tools/examples/vd_list.py -400c774eVfeVCkLn34s-Lh4-6jBXWw tools/examples/vd_read_from_file.py -40083bb4NhDpKiYTrebI3ZjX__oI_w tools/examples/vd_refresh.py -400c774eXs8hWKK70ZYzi1ScKiSjPQ tools/examples/vd_to_file.py -400c33001-uDKTfHBchTKUwuMFcqTA tools/examples/vd_undelete.py 401d7e16NpnVrFSsR7lKKKfTwCYvWA tools/examples/xc_dom_control.py 401d7e16RJj-lbtsVEjua6HYAIiKiA tools/examples/xc_dom_create.py 401d7e16X4iojyKopo_j63AyzYZd2A tools/examples/xc_vd_tool.py @@ -80,7 +61,6 @@ 3f13d81eQ9Vz-h-6RDGFkNR9CRP95g tools/misc/xen_nat_enable 3f13d81e6Z6806ihYYUw8GVKNkYnuw tools/misc/xen_nat_enable.README 3f1668d4F29Jsw0aC0bJEIkOBiagiQ tools/misc/xen_read_console.c -3f87ba90EUVPQLVOlFG0sW89BCwouQ tools/misc/xen_refresh_dev.c 3fbca441SjQr8vJwTQIgH1laysaWog tools/xc/Makefile 3fbba6dbDfYvJSsw9500b4SZyUhxjQ tools/xc/lib/Makefile 3fbba6dc1uU7U3IFeF6A-XEOYF2MkQ tools/xc/lib/rpm.spec diff --git a/tools/examples/add_vbd_to_dom.py b/tools/examples/add_vbd_to_dom.py deleted file mode 100644 index 629ca40617..0000000000 --- a/tools/examples/add_vbd_to_dom.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python - -# Used to map a VBD into a domain's device space. Useful for populating a new -# VBD with data from DOM0 before starting a new domain using it, for instance. - -import Xc, XenoUtil, sys - -XenoUtil.VBD_EXPERT_LEVEL = 0 # sets the allowed level of potentially unsafe mappings - -def usage(): - print >>sys.stderr,"""Usage: add_vdisk_to_dom.py uname target-dev target-dom [perms] - uname - the uname of the source device, e.g. vd:2341 or phy:hda3 - target-dev - the device node to map the VBD to - target-dom - domain to add the new VBD to - perms - optionally specify 'r', or 'rw' (default is 'r') - """ - sys.exit(1) - -xc = Xc.new() - -if not 4 <= len(sys.argv) <= 5: - print len(sys.argv) - usage() - -writeable = 0 - -if len(sys.argv) == 5: - if sys.argv[4] == 'rw': - writeable = 1; - else: - if sys.argv[4] != 'r': - usage() - -segments = XenoUtil.lookup_disk_uname(sys.argv[1]) - -if XenoUtil.vd_extents_validate(segments,writeable) < 0: - print "That mapping is too unsafe for the current VBD expertise level" - sys.exit(1) - -virt_dev = XenoUtil.blkdev_name_to_number(sys.argv[2]) - -target_dom = int(sys.argv[3]) - -xc.vbd_create(target_dom,virt_dev,writeable) - -if xc.vbd_setextents( target_dom, virt_dev, segments ): - print "Error populating VBD vbd=%d\n" % virt_dev - sys.exit(1) - - -print "Added " + sys.argv[1] + " to domain " + sys.argv[3] + " as device " + sys.argv[2] diff --git a/tools/examples/createlinuxdom.py b/tools/examples/createlinuxdom.py deleted file mode 100755 index 31b8aece81..0000000000 --- a/tools/examples/createlinuxdom.py +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env python - -# -# Example script for creating and building a new Linux guest OS for Xen. -# It takes an optional parameter that specifies offsets to be added to the -# ip address and root partition numbers, enabling multiple domains to be -# started from the one script. -# -# Edit as required... -# - -import Xc, XenoUtil, string, sys, os, time, socket - -# initialize a few variables that might come in handy -thishostname = socket.gethostname() -guestid = 0 -if len(sys.argv) >= 2: - guestid = string.atoi(sys.argv[1]) - print "Offset to add to guest's IP etc : %d\n" % guestid - -##### This section of the code establishes various settings to be used -##### for this guest virtual machine - -# STEP 1. Specify kernel image file. Can be gzip'ed. -image = "../../../install/boot/xenolinux.gz" - -# STEP 2. How many megabytes of memory for the new domain? -memory_megabytes = 64 - -# STEP 3. A handy name for your new domain. -domain_name = "This is VM %d" % guestid - -# STEP 4. Specify IP address(es), netmask and gateway for the new -# domain. You need to configure IP addrs within the domain just as -# you do normally. This is just to let Xen know about them so it can -# route packets appropriately. - -#ipaddr = ["111.222.333.444","222.333.444.555"] -ipaddr = [XenoUtil.add_offset_to_ip(XenoUtil.get_current_ipaddr(),guestid)] -netmask = XenoUtil.get_current_ipmask() -gateway = XenoUtil.get_current_ipgw() -nfsserv = '169.254.1.0' # You need to set this if you're using NFS root - -# STEP 5. Identify any physcial partitions or virtual disks you want the -# domain to have access to, and what you want them accessible as -# e.g. vbds = [ ('phy:sda1','sda1', 'w'), -# ('phy:sda4','sda%d' % (3+guestid), 'r'), -# ('vd:as73gd784dh','hda1','w') ] - -vbds = [ ('phy:sda%d'%(7+guestid),'sda1','w' ), - ('phy:sda6','sda6','r'), - ('phy:cdrom','hdd','r') ] - -# STEP 5b. Set the VBD expertise level. Most people should leave this -# on 0, at least to begin with - this script can detect most dangerous -# disk sharing between domains and with this set to zero it will only -# allow read only sharing. -vbd_expert = 0 - -# STEP 6. Build the command line for the new domain. Edit as req'd. -# You only need the ip= line if you're NFS booting or the root file system -# doesn't set it later e.g. in ifcfg-eth0 or via DHCP -# You can use 'extrabit' to set the runlevel and custom environment -# variables used by custom rc scripts (e.g. DOMID=, usr= ) - -ipbit = "ip="+ipaddr[0]+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off" -rootbit = "root=/dev/sda1 ro" -#rootbit = "root=/dev/nfs nfsroot=/full/path/to/root/directory" -extrabit = "4 DOMID=%d usr=/dev/sda6" % guestid -cmdline = ipbit +" "+ rootbit +" "+ extrabit - -# STEP 7. Set according to whether you want the script to watch the domain -# and auto-restart it should it die or exit. - -auto_restart = False -#auto_restart = True - - -##### Print some debug info just incase things don't work out... -##### - -print "Domain image : ", image -print "Domain memory : ", memory_megabytes -print "Domain IP address(es) : ", ipaddr -print "Domain block devices : ", vbds -print 'Domain cmdline : "%s"' % cmdline - - -##### Code beyond this point is actually used to manage the mechanics of -##### starting (and watching if necessary) guest virtual machines. - -# Obtain an instance of the Xen control interface -xc = Xc.new() - -# This function creates, builds and starts a domain, using the values -# in the global variables, set above. It is used in the subsequent -# code for starting the new domain and rebooting it if appropriate. -def make_domain(): - """Create, build and start a domain. - Returns: [int] the ID of the new domain. - """ - - # set up access to the global variables declared above - global image, memory_megabytes, domain_name, ipaddr, netmask - global vbds, cmdline, xc, vbd_expert - - if not os.path.isfile( image ): - print "Image file '" + image + "' does not exist" - sys.exit() - - id = xc.domain_create( mem_kb=memory_megabytes*1024, name=domain_name ) - print "Created new domain with id = " + str(id) - if id <= 0: - print "Error creating domain" - sys.exit() - - ret = xc.linux_build( dom=id, image=image, cmdline=cmdline ) - if ret < 0: - print "Error building Linux guest OS: " - print "Return code from linux_build = " + str(ret) - xc.domain_destroy ( dom=id ) - sys.exit() - - # setup the virtual block devices - - # set the expertise level appropriately - XenoUtil.VBD_EXPERT_MODE = vbd_expert - - for ( uname, virt_name, rw ) in vbds: - virt_dev = XenoUtil.blkdev_name_to_number( virt_name ) - - segments = XenoUtil.lookup_disk_uname( uname ) - if not segments: - print "Error looking up %s\n" % uname - xc.domain_destroy ( dom=id ) - sys.exit() - - # check that setting up this VBD won't violate the sharing - # allowed by the current VBD expertise level - if XenoUtil.vd_extents_validate(segments, rw=='w') < 0: - xc.domain_destroy( dom = id ) - sys.exit() - - if xc.vbd_create( dom=id, vbd=virt_dev, writeable= rw=='w' ): - print "Error creating VBD vbd=%d writeable=%d\n" % (virt_dev,rw) - xc.domain_destroy ( dom=id ) - sys.exit() - - if xc.vbd_setextents( dom=id, - vbd=virt_dev, - extents=segments): - print "Error populating VBD vbd=%d\n" % virt_dev - xc.domain_destroy ( dom=id ) - sys.exit() - - # setup virtual firewall rules for all aliases - for ip in ipaddr: - XenoUtil.setup_vfr_rules_for_vif( id, 0, ip ) - - if xc.domain_start( dom=id ) < 0: - print "Error starting domain" - xc.domain_destroy ( dom=id ) - sys.exit() - - return id -# end of make_domain() - - - -# The starting / monitoring of the domain actually happens here... - -# start the domain and record its ID number -current_id = make_domain() - -# if the auto_restart flag is set then keep polling to see if the domain is -# alive - restart if it is not by calling make_domain() again (it's necessary -# to update the id variable, since the new domain may have a new ID) - -while auto_restart: - time.sleep(1) - if not xc.domain_getinfo(current_id): - print "The virtual machine has terminated, restarting in a new domain" - current_id = make_domain() diff --git a/tools/examples/destroydom.py b/tools/examples/destroydom.py deleted file mode 100755 index 5bf6b761ba..0000000000 --- a/tools/examples/destroydom.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python - -# -# Destroy specified domain. -# - -import Xc, sys, re - -xc = Xc.new() - -if len(sys.argv) < 2: - print "Specify a domain identifier" - sys.exit() - -if (len(sys.argv) > 2) and re.match( 'force', sys.argv[2] ): - xc.domain_destroy( dom=int(sys.argv[1]), force=1 ) -else: - xc.domain_destroy( dom=int(sys.argv[1]), force=0 ) diff --git a/tools/examples/list_vbds.py b/tools/examples/list_vbds.py deleted file mode 100644 index de13c5101c..0000000000 --- a/tools/examples/list_vbds.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - - -import Xc, sys - -xc = Xc.new() - -print xc.vbd_probe() diff --git a/tools/examples/listdoms.py b/tools/examples/listdoms.py deleted file mode 100755 index 0bc3d9b848..0000000000 --- a/tools/examples/listdoms.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python - -# -# List info on all domains. -# - -import Xc, sys -xc = Xc.new() -print xc.domain_getinfo() - diff --git a/tools/examples/pincpu.py b/tools/examples/pincpu.py deleted file mode 100755 index f010f249c1..0000000000 --- a/tools/examples/pincpu.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python - -# -# Destroy specified domain. -# - -import Xc, sys, re, time - -xc = Xc.new() - -if len(sys.argv) < 3: - print "Specify a domain identifier and CPU" - sys.exit() - -dom = int(sys.argv[1]) -cpu = int(sys.argv[2]) - -orig_state = xc.domain_getinfo(first_dom=dom, max_doms=1)[0]['stopped'] - -while xc.domain_getinfo(first_dom=dom, max_doms=1)[0]['stopped'] != 1: - xc.domain_stop( dom=dom ) - time.sleep(0.1) - -xc.domain_pincpu( dom, cpu ) - -if orig_state == 0: - xc.domain_start( dom=dom ) - - - - diff --git a/tools/examples/readxenconsolering.py b/tools/examples/readxenconsolering.py deleted file mode 100644 index 0e9305a1f3..0000000000 --- a/tools/examples/readxenconsolering.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2003 by Intel Research Cambridge - -# File: tools/examples/readconsolering.py -# Author: Mark A Williamson (mark.a.williamson@intel.com) -# Date: 2003-12-02 - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - - -"""Reads out the contents of the console ring - -Usage: readconsolering.py [-c] -The -c option causes the contents to be cleared. -""" - -import sys, Xc # import the Xc Xen Control module - -xc = Xc.new() # get a new instance of the control interface - -clear_buffer = False - -if sys.argv[1:] != []: - if sys.argv[1] == "-c": - clear_buffer = True - else: - print >> sys.stderr, "Usage: " + sys.argv[0] + """ [-c] - Reads the contents of the console buffer. - (specifying -c will also clear current contents)""" - -# Get the console ring's contents as a string and print it out. -# If argument to readconsolering is true then the buffer is cleared as well as -# fetching the (pre-clearing) contents. -print xc.readconsolering(clear_buffer) diff --git a/tools/examples/remove_vbd_from_dom.py b/tools/examples/remove_vbd_from_dom.py deleted file mode 100644 index 0db60f2be8..0000000000 --- a/tools/examples/remove_vbd_from_dom.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -# Used to map a VBD into a domain's device space. Useful for populating a new -# VBD with data from DOM0 before starting a new domain using it, for instance. - -# Usage: add_vdisk_to_dom.py uname target-dev-name target-dom-number -# uname - the uname of the device, e.g. vd:2341 or phy:hda3 -# target-dev-name - the device node to map the VBD to -# target-dom-number - domain to add the new VBD to - -import Xc, XenoUtil, sys - -xc = Xc.new() - -if len(sys.argv) != 3: - print >>sys.stderr,"""Usage: add_vdisk_to_dom.py target-dev target-dom - target-dev - the device node the VBD is mapped to - target-dom - domain to remove the VBD from""" - sys.exit(1) - -virt_dev = XenoUtil.blkdev_name_to_number(sys.argv[1]) - -target_dom = int(sys.argv[2]) - -if not xc.vbd_destroy(target_dom,virt_dev): - print "Removed " + sys.argv[1] + " from domain " + sys.argv[2] -else: - print "Failed" - sys.exit(1) diff --git a/tools/examples/startdom.py b/tools/examples/startdom.py deleted file mode 100755 index 0a4a53c974..0000000000 --- a/tools/examples/startdom.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -# -# Start execution of specified domain. -# - -import Xc, sys, re - -xc = Xc.new() - -if len(sys.argv) != 2: - print "Specify a domain identifier" - sys.exit() - -xc.domain_start( dom=int(sys.argv[1]) ) diff --git a/tools/examples/stopdom.py b/tools/examples/stopdom.py deleted file mode 100755 index aa20a97ac0..0000000000 --- a/tools/examples/stopdom.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -# -# Stop execution of specified domain. -# - -import Xc, sys, re - -xc = Xc.new() - -if len(sys.argv) != 2: - print "Specify a domain identifier" - sys.exit() - -xc.domain_stop( dom=int(sys.argv[1]) ) diff --git a/tools/examples/vd_create.py b/tools/examples/vd_create.py deleted file mode 100644 index 316e787ccd..0000000000 --- a/tools/examples/vd_create.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python - -# -# Wrapper script for creating a virtual disk. -# -# Usage: vd_create.py size [expiry] -# - -import XenoUtil, sys - -if len(sys.argv) > 1: - size = int(sys.argv[1]) -else: - print "Usage: " + sys.argv[0] + """ size [expiry] - Allocates a Virtual Disk out of the free space pool. An expiry time - can be specified in seconds from now (0 means never expire) - the default - is for disks to never expire.""" - sys.exit(1) - -if len(sys.argv) > 2: - expiry_time = int(sys.argv[2]) -else: - print "No expiry time specified - using default\n" - expiry_time = 0 - -print "Creating a virtual disk" -print "Size: %d" % size -print "Expiry time (seconds from now): %d" % expiry_time - -ret = XenoUtil.vd_create(size, expiry_time) - -if ret < 0: - print >> sys.stderr, "An error occurred creating the the disk" - sys.exit(ret) -else: - print "Virtual disk allocated, with ID: " + ret diff --git a/tools/examples/vd_delete.py b/tools/examples/vd_delete.py deleted file mode 100644 index ca2a3fd19f..0000000000 --- a/tools/examples/vd_delete.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -# -# Wrapper script for deleting a virtual disk. -# -# Usage: vd_create.py id -# - -import sys, XenoUtil - -if len(sys.argv) > 1: - id = sys.argv[1] -else: - print "Usage: " + sys.argv[0] + """ id - Deletes a virtual disk.""" - sys.exit(1) - -print "Deleting a virtual disk with ID: " + id - -ret = XenoUtil.vd_delete(id) - -if ret: - print "Deletion failed: invalid ID, or disk already expired / deleted" diff --git a/tools/examples/vd_format.py b/tools/examples/vd_format.py deleted file mode 100644 index d7402be996..0000000000 --- a/tools/examples/vd_format.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -# -# Wrapper script for formatting a device to host Xen virtual disk extents -# -# Usage: vd_format.py device [extent_size] -# - -import sys, XenoUtil - -if len(sys.argv) > 1: - device = sys.argv[1] -else: - print "Usage: " + sys.argv[0] + """ device [extent_size] - Formats a device to host Xen virtual disk extents. The extent size can - optionally be specified in megabytes (default 64MB).""" - sys.exit(1) - -if len(sys.argv) > 2: - extent_size = int(sys.argv[2]) -else: - print """No extent size specified - using default size - (for really small devices, the default size of 64MB might not work)""" - extent_size = 64 - -print "Formatting for virtual disks" -print "Device: " + sys.argv[1] -print "Extent size: " + str(extent_size) + "MB" - -ret = XenoUtil.vd_format(device, extent_size) - -if ret: - print >> sys.stderr, "An error occurred formatting the device" - sys.exit(ret) diff --git a/tools/examples/vd_freespace.py b/tools/examples/vd_freespace.py deleted file mode 100644 index 5ebc76260f..0000000000 --- a/tools/examples/vd_freespace.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python - -# -# vd_freespace.py -# -# Prints out the amount of free space (in megabytes) for creating virtual disks. -# - -import XenoUtil - -print XenoUtil.vd_freespace() diff --git a/tools/examples/vd_list.py b/tools/examples/vd_list.py deleted file mode 100644 index 6be8ccbcbc..0000000000 --- a/tools/examples/vd_list.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python - -# -# vd_list.py - use this to list all the unexpired virtual disks in the -# virtual disk database -# - -import XenoUtil - -print XenoUtil.vd_list() diff --git a/tools/examples/vd_read_from_file.py b/tools/examples/vd_read_from_file.py deleted file mode 100644 index c665d4333c..0000000000 --- a/tools/examples/vd_read_from_file.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -# -# vd_read_from_file.py filename -# -# Reads a virtual disk in from a file and allocates a VD (prints out its ID) -# - -import XenoUtil, sys - -if len(sys.argv) < 2: - print "Usage: " + sys.argv[0] + """ filename [expiry] - Reads in a virtual disk form a file and allocates a VD. - Can optionally set the expiry time in seconds from now - (default - don't expire) - """ - sys.exit() - -if len(sys.argv) > 2: - expiry = int(sys.argv[2]) -else: - expiry = 0 - -ret = XenoUtil.vd_read_from_file(sys.argv[1], expiry) - -if ret < 0: - print "Operation failed" -else: - print "File " + sys.argv[1] + " read into virtual disk ID " + ret diff --git a/tools/examples/vd_refresh.py b/tools/examples/vd_refresh.py deleted file mode 100644 index afbdfb8ea8..0000000000 --- a/tools/examples/vd_refresh.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python - -# -# Wrapper script for creating a virtual disk. -# -# Usage: vd_refresh.py id [new-expiry] -# - -import sys, XenoUtil - -if len(sys.argv) > 1: - id = sys.argv[1] -else: - print "Usage: " + sys.argv[0] + """ ID [expiry-new] - Refreshes a Virtual Disk expiry time. An expiry time - can be specified in seconds from now (0 means never expire) - the default - is for disks to never expire.""" - sys.exit(1) - -if len(sys.argv) > 2: - expiry_time = int(sys.argv[2]) -else: - print "No expiry time specified - using default\n" - expiry_time = 0 - -print "Refreshing a virtual disk" -print "Id: " + sys.argv[1] -print "Expiry time (seconds from now): " + sys.argv[2] - -ret = XenoUtil.vd_refresh(id, expiry_time) - -if ret: - print "Refresh failed, non-existent virtual disk or disk is expired / deleted" diff --git a/tools/examples/vd_to_file.py b/tools/examples/vd_to_file.py deleted file mode 100644 index de0b9ff2eb..0000000000 --- a/tools/examples/vd_to_file.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -# -# vd_to_file.py filename [-m] -# -# Writes a virtual disk out to a file. Optionally, the "-m" (move) -# flag causes the virtual disk to be deallocated once its data is -# read out. - -import XenoUtil, sys - -def usage(): - print "Usage: " + sys.argv[0] + """ vdisk_id filename [-m] - Writes a virtual disk out to a file. Optionally, the "-m" (move) - flag causes the virtual disk to be deallocated once its data is - read out. - """ - sys.exit() - -if not 3 <= len(sys.argv) <= 4: - usage() - -if len(sys.argv) == 4: - if sys.argv[3] != "-m": - usage() - else: - print "Doing move to file..." - if XenoUtil.vd_mv_to_file(sys.argv[1],sys.argv[2]): - print "Failed" -else: - print "Doing copy to file..." - if XenoUtil.vd_cp_to_file(sys.argv[1], sys.argv[2]): - print "Failed" - diff --git a/tools/examples/vd_undelete.py b/tools/examples/vd_undelete.py deleted file mode 100644 index d43c773c36..0000000000 --- a/tools/examples/vd_undelete.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -# -# vd_undelete.py vdisk_id [ new_expiry ] -# -# Undeletes a VD and, optionally, sets a new expiry time or disables -# expiry if the time value is zero (default) -# - -import XenoUtil, sys - -if len(sys.argv) < 2: - print >>sys.stderr, "Usage: " + sys.argv[0] + """ vdisk_id [ new_expiry ] - vdisk_id - the identifier of the deleted VD - new_expiry - optionally the new expiry time in seconds from now (0 - for never expire - which is the default) - - VDs can currently only be undeleted if it is safe to do so, - i.e. if none of their space has been reallocated. - """ - -vdisk_id = sys.argv[1] - -if len(sys.argv) == 3: - expiry = int(sys.argv[2]) -else: - expiry = 0 - -if XenoUtil.vd_undelete(vdisk_id, expiry): - print "Undelete operation failed for virtual disk: " + vdisk_id -else: - print "Undelete operation succeeded for virtual disk: " + vdisk_id diff --git a/tools/misc/xen_refresh_dev.c b/tools/misc/xen_refresh_dev.c deleted file mode 100644 index b9ea025c1f..0000000000 --- a/tools/misc/xen_refresh_dev.c +++ /dev/null @@ -1,49 +0,0 @@ -/****************************************************************************** - * xen_refresh_dev.c - * - * Refresh our view of a block device by rereading its partition table. This - * is necessary to synchronise with VBD attaches and unattaches in Xen. - * Currently there's no automatic plumbing of attach/unattach requests. - * - * Copyright (c) 2003, K A Fraser - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* BLKRRPART */ - -int main(int argc, char **argv) -{ - int fd; - - if ( argc != 2 ) - { - fprintf(stderr, "xen_refresh_dev \ne.g., /dev/xvda\n"); - return 1; - } - - if ( (fd = open(argv[1], O_RDWR)) == -1 ) - { - fprintf(stderr, "Error opening %s: %s (%d)\n", - argv[1], strerror(errno), errno); - return 1; - } - - if ( ioctl(fd, BLKRRPART) == -1 ) - { - fprintf(stderr, "Error executing BLKRRPART on %s: %s (%d)\n", - argv[1], strerror(errno), errno); - return 1; - } - - close(fd); - - return 0; -} -- 2.30.2